package com.socct.test2


import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.os.bundleOf
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_main.view.*

/**
 * A simple [Fragment] subclass.
 */
class MainFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        val view = inflater.inflate(R.layout.fragment_main, container, false)
        initView(view)
        return view
    }

    private fun initView(view: View?) {
        view?.let {
            view.btn1.setOnClickListener {
                findNavController().navigate(R.id.to_to)
            }
            view.btn2.setOnClickListener {
                findNavController().navigate(R.id.action_main_to_fragment3)
            }
            view.btn3.setOnClickListener {
                findNavController().navigate(R.id.action_fragment2_to_testFragment7)
            }
            view.btn4.setOnClickListener {
                var bundleOf = bundleOf("aaa" to 1, "vvv" to 2)
                findNavController().navigate(R.id.glole)
            }
            view.btn5.setOnClickListener {
                findNavController().navigate(R.id.action_main_to_testFragment9)
            }
            view.btn6.setOnClickListener {
                findNavController().navigate(R.id.action_main_to_blankFragment)
            }
            view.btn7.setOnClickListener {
                findNavController().navigate(R.id.action_main_to_blankFragment2)
            }
        }
    }


}
